package javaFX;

import javafx.application.Application;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.stage.Modality;
import javafx.stage.Stage;
import javafx.stage.StageStyle;

public class StageDemon extends Application {
    public static void main(String[] args) {
        launch(args);

    }

    @Override
    public void start(Stage primaryStage) throws Exception {
        /*锢态窗口效果*/
        Stage s1=new Stage();
        s1.setTitle("第1");
        s1.initStyle(StageStyle.UTILITY);//对窗口风格经行设置
        s1.setX(20);//对初始的位置经行设置
        s1.xProperty().addListener(new ChangeListener<Number>() {//对监听器经行设置
            @Override
            public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
                System.out.println("窗口坐标="+newValue);
            }
        });

        Stage s2=new Stage();
        s2.setTitle("第2");
        s2.initOwner(s1);
        s2.initModality(Modality.WINDOW_MODAL);//s1窗口属于s2,只有对s2经行关闭才可以对s1经行操作

        Stage s3=new Stage();
        s3.setTitle("第3");
        s3.initModality(Modality.APPLICATION_MODAL);//只可以对s3窗口经行操作，即固态话

        s1.show();s2.show();s3.show();


    }
}
